package Prova::Checksum;

use strict;
use warnings;
use Digest::MD5;

my $word   = '86r4989p2[qhakfnvalsduqwe9uj3ohfai8qrhqba/snv3oy';
my $length = 16;

=head1 NAME

Prova::Checksum

=head1 DESCRIPTION

none

=head1 METHODS

=cut

=head2 calc

=cut

sub calc {
    my ( $self, $text ) = @_;

    $text = 'abcdefg' unless $text;
    my $str = Digest::MD5->new->add( $word . time . rand($text) )->hexdigest;
    $str = substr( $str, 0, $length );
    $str =~ s/\//-/g;

    return $str;
}

=head1 AUTHOR

Shanon Inc, E<lt>http://www.shanon.co.jp/E<gt>

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;
